<?php

namespace App\Http\Controllers;

use App\Handles\UniounPayHandle;
use Illuminate\Http\Request;

class WithDrawController extends Controller
{
    public function store(UniounPayHandle $uniounPayHandle)
    {
        $now_date = date('Y-m-d');
        $uniounPayHandle->sumWithDraw($now_date, $now_date);



        return view('constrast', compact('now_date'));
    }

    public function showConstrast(Request $request, UniounPayHandle $uniounPayHandle)
    {
        $start_date = $request->start_date;
        $end_date = $request->end_date;

        if(empty($start_date) || empty($end_date)){
            return [
                'code' => '234',
                'msg' => '开始时间/结束时间不能为空',
            ];
        }

        if($start_date > $end_date){
            return [
                'code' => '233',
                'msg' => '开始时间不能小于结束时间',
            ];
        }

        $sum_unionpay_amt = $uniounPayHandle->sumWithDraw($start_date, $end_date);

    }
}
